#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

// 3479. 水果成篮 III
// https://leetcode.cn/problems/fruits-into-baskets-iii/description/?envType=daily-question&envId=2025-08-06

class Solution {
public:
    int numOfUnplacedFruits(vector<int>& fruits, vector<int>& baskets) {
        int ans = 0;
        for (int i = 0; i < fruits.size(); i++){
            int j = 0;
            for (; j < baskets.size(); j++)
            {
                if(fruits[i] <= baskets[j]){
                    baskets[j] = 0;
                    break;
                }
            }
            if(j == baskets.size()){
                ans++;
            }
        }
        return ans;
    }
};

int main()
{
    vector<int> fruits{41, 43, 94};
    vector<int> baskets{39, 10, 47};
    Solution solution{};
    solution.numOfUnplacedFruits(fruits, baskets);

    return 0;
}